<?php
//echo $_POST['username'].'<br/>';
//echo $_POST['sex'].'<br/>';
//echo $_POST['message'].'<br/>';
//echo '<img src='.'"'.$_POST['imgurl'].'"'.'/>';
require 'db.php';
$username=$_POST['username'];
$sex=$_POST['sex'];
$message=$_POST['message'];
$imgurl=$_POST['imgurl'];
date_default_timezone_set("Asia/Shanghai");
$m_date=  date('Y/m/d   H:i:s');
$sp="insert into t_message(username,message,sex,imgurl,m_date) values('$username','$message','$sex','$imgurl','$m_date')";
$rs=$db->query($sp);
if($rs){
   echo '<script anguage="javascript">';
    echo 'alert("成功了！");';
    echo 'window.location.href="index.php"';
    echo '</script>';
}else{
    echo '<script anguage="javascript">';
    echo 'alert("失败了！");';
    echo 'window.location.href="index.php"';
    echo '</script>';
}
$db->close();